package com.sqx.modules.search.controller;

import com.alibaba.fastjson.JSONObject;
import com.sqx.common.utils.Result;
import com.sqx.modules.search.service.SearchRecordService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 搜索记录(SearchRecord)表控制层
 *
 * @author makejava
 * @since 2024-05-28 09:33:01
 */
@RestController
@RequestMapping("searchRecord")
@Api(value = "搜索词-管理端", tags = "{搜索词-管理端}")
public class SearchRecordController {
    /**
     * 服务对象
     */
    @Resource
    private SearchRecordService searchRecordService;

    /**
     * 搜索词排行榜
     *
     * @param params 条件
     * @return 查询结果
     */
    @PostMapping("/groupByKeys")
    public Result groupByKeys(@RequestBody JSONObject params) {
        Result result = searchRecordService.queryRcordPage(params);
        return result;
    }

    /**
     * 搜索记录
     * @param params 条件
     * @return 结果
     */
    @PostMapping("/searchRecord")
    public Result querySearchRecord(@RequestBody JSONObject params){
        Result result = searchRecordService.querySearchRecord(params);
        return result;
    }

}

